import { ElMessageBox, ElMessage, ElNotification, type messageType } from 'element-plus'

export class Ui {
  static useMessageBox({ text = '确定执行该操作吗？', type = 'warning', tip = '提示', confirmButtonText = '确定', cancelButtonText = '取消', handleConfirm = () => {}, handleCancle = () => {} }) {
    ElMessageBox.confirm(text, tip, {
      confirmButtonText,
      cancelButtonText,
      type: type as messageType
    })
      .then(() => handleConfirm())
      .catch(() => handleCancle())
  }

  static useMessage(type: messageType, message: string) {
    ElMessage({
      message,
      type
    })
  }

  static useNotice(msg: string, type: messageType = 'warning', title = '提示') {
    ElNotification({
      title,
      message: msg,
      type: type
    })
  }
}
